import { reqAddressInfo, reqOrderInfo, reqSubmitOrder } from '@/api';

const state = {
	addressInfo: [],
	orderInfo: []
};
const mutations = {
	GETADDRESSINFO(state, data) {
		state.addressInfo = data;
	},
	GETORDERINFO(state, data) {
		state.orderInfo = data;
	}
};
const actions = {
	/**
	 * 获取用户地址信息
	 */
	async getAddressInfo({ commit }) {
		let res = await reqAddressInfo();
		// console.log(res);
		if (res.code == 200) {
			commit('GETADDRESSINFO', res.data);
		}
	},
	/**
	 * 获取商品清单数据
	 */
	async getOrderInfo({ commit }) {
		let res = await reqOrderInfo();
		// console.log(res);
		if (res.code == 200) {
			commit('GETORDERINFO', res.data);
		}
	}
};
const getters = {};

export default {
	state,
	mutations,
	actions,
	getters
};
